home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / ifl / libppm.z / libppm
Encoding:
Text File  |  1998-10-20  |  7.4 KB  |  199 lines

  1.  
  2.  
  3.  
  4. lllliiiibbbbppppppppmmmm((((3333))))         IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll          lllliiiibbbbppppppppmmmm((((3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      libppm - functions to support portable pixmap programs
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      #include <ppm.h>
  13.      cc ... libppm.a libpgm.a libpbm.a
  14.  
  15.  
  16. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  17.    TTTTYYYYPPPPEEEESSSS AAAANNNNDDDD CCCCOOOONNNNSSSSTTTTAAAANNNNTTTTSSSS
  18.      typedef ... pixel;
  19.      typedef ... pixval;
  20.      #define PPM_MAXMAXVAL ...
  21.      extern pixval ppm_pbmmaxval;
  22.  
  23.      Each ppppiiiixxxxeeeellll contains three ppppiiiixxxxvvvvaaaalllls, each of which should contain only the
  24.      values between 0000 and PPPPPPPPMMMM____MMMMAAAAXXXXMMMMAAAAXXXXVVVVAAAALLLL.  ppppppppmmmm____ppppbbbbmmmmmmmmaaaaxxxxvvvvaaaallll is the maxval used
  25.      when a PPM program reads a PBM file.  Normally it is 1; however, for some
  26.      programs, a larger value gives better results.
  27.  
  28.      #define PPM_FORMAT ...
  29.      #define RPPM_FORMAT ...
  30.      #define PPM_TYPE PPM_FORMAT
  31.      int PPM_FORMAT_TYPE( int format )
  32.  
  33.      For distinguishing different file formats and types.
  34.  
  35.      pixval PPM_GETR( pixel p )
  36.      pixval PPM_GETG( pixel p )
  37.      pixval PPM_GETB( pixel p )
  38.  
  39.      These three macros retrieve the red, green or blue value from the given
  40.      pixel.
  41.  
  42.      void PPM_ASSIGN( pixel p, pixval red, pixval grn, pixval blu )
  43.  
  44.      This macro assigns the given red, green and blue values to the pixel.
  45.  
  46.      int PPM_EQUAL( pixel p, pixel q )
  47.  
  48.      This macro checks two pixels for equality.
  49.  
  50.      void PPM_DEPTH( pixel newp, pixel p, pixval oldmaxval, pixval newmaxval )
  51.  
  52.      This macro scales the colors of pixel pppp according the old and new maximum
  53.      values and assigns the new values to nnnneeeewwwwpppp.  It is intended to make
  54.      writing ppmtowhatever easier.
  55.  
  56.      float PPM_LUMIN( pixel p )
  57.  
  58.      This macro determines the luminance of the pixel pppp.
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. lllliiiibbbbppppppppmmmm((((3333))))         IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll          lllliiiibbbbppppppppmmmm((((3333))))
  71.  
  72.  
  73.  
  74.    MMMMEEEEMMMMOOOORRRRYYYY MMMMAAAANNNNAAAAGGGGEEEEMMMMEEEENNNNTTTT
  75.      pixel** ppm_allocarray( int cols, int rows )
  76.  
  77.      Allocate an array of pixels.
  78.  
  79.      pixel* ppm_allocrow( int cols )
  80.  
  81.      Allocate a row of the given number of pixels.
  82.  
  83.      void ppm_freearray( pixel** pixels, int rows )
  84.  
  85.      Free the array allocated with ppppppppmmmm____aaaallllllllooooccccaaaarrrrrrrraaaayyyy(((()))) containing the given
  86.      number of rows.
  87.  
  88.      void pbm_freerow( pixel* pixelrow )
  89.  
  90.      Free a row of pixels.
  91.  
  92.    RRRREEEEAAAADDDDIIIINNNNGGGG PPPPBBBBMMMM FFFFIIIILLLLEEEESSSS
  93.      void ppm_readppminit( FILE* fp, int* colsP, int* rowsP, pixval* maxvalP, int* formatP )
  94.  
  95.      Read the header from a PPM file, filling in the rows, cols, maxval and
  96.      format variables.
  97.  
  98.      void ppm_readppmrow( FILE* fp, pixel* pixelrow, int cols, pixval maxval, int format )
  99.  
  100.      Read a row of pixels into the pixelrow array.  Format, cols, and maxval
  101.      were filled in by ppppppppmmmm____rrrreeeeaaaaddddppppppppmmmmiiiinnnniiiitttt(((()))).
  102.  
  103.      pixel** ppm_readppm( FILE* fp, int* colsP, int* rowsP, pixval* maxvalP )
  104.  
  105.      Read an entire pixmap file into memory, returning the allocated array and
  106.      filling in the rows, cols and maxval variables.  This function combines
  107.      ppppppppmmmm____rrrreeeeaaaaddddppppppppmmmmiiiinnnniiiitttt(((()))), ppppppppmmmm____aaaallllllllooooccccaaaarrrrrrrraaaayyyy(((()))) and ppppppppmmmm____rrrreeeeaaaaddddppppppppmmmmrrrroooowwww(((()))).
  108.  
  109.    WWWWRRRRIIIITTTTIIIINNNNGGGG FFFFIIIILLLLEEEESSSS
  110.      void ppm_writeppminit( FILE* fp, int cols, int rows, pixval maxval, int forceplain )
  111.  
  112.      Write the header for a portable pixmap file.  The forceplain flag forces
  113.      a plain-format file to be written, as opposed to a raw-format one.
  114.  
  115.      void ppm_writeppmrow( FILE* fp, pixel* pixelrow, int cols, pixval maxval, int forceplain )
  116.  
  117.      Write a row from a portable pixmap.
  118.  
  119.      void ppm_writeppm( FILE* fp, pixel** pixels, int cols, int rows, pixval maxval, int forceplain )
  120.  
  121.      Write the header and all data for a portable pixmap.  This function
  122.      combines ppppppppmmmm____wwwwrrrriiiitttteeeeppppppppmmmmiiiinnnniiiitttt(((()))) and ppppppppmmmm____wwwwrrrriiiitttteeeeppppppppmmmmrrrroooowwww(((()))).
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. lllliiiibbbbppppppppmmmm((((3333))))         IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll          lllliiiibbbbppppppppmmmm((((3333))))
  137.  
  138.  
  139.  
  140.    CCCCOOOOLLLLOOOORRRR NNNNAAAAMMMMEEEESSSS
  141.      pixel ppm_parsecolor( char* colorname, pixval maxval )
  142.  
  143.      Parses an ASCII color name into a pixel.  The color can be specified in
  144.      three ways.  One, as a name, assuming that a pointer to an X11-style
  145.      color names file was compiled in.  Two, as an X11-style hexadecimal
  146.      number: #rgb, #rrggbb, #rrrgggbbb, or #rrrrggggbbbb.  Three, as a triplet
  147.      of decimal floating point numbers separated by commas: r.r,g.g,b.b.
  148.  
  149.      char* ppm_colorname( pixel* colorP, pixval maxval, int hexok )
  150.  
  151.      Returns a pointer to a string describing the given color.  If the X11
  152.      color names file is available and the color appears in it, that name is
  153.      returned.  Otherwise, if the hexok flag is true then a hexadecimal
  154.      colorspec is returned; if hexok is false and the X11 color names file is
  155.      available, then the closest matching color is returned; otherwise, it's
  156.      an error.
  157.  
  158. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  159.      pbm(3), pgm(3)
  160.  
  161. AAAAUUUUTTTTHHHHOOOORRRR
  162.      Copyright (C) 1989, 1991 by Tony Hansen and Jef Poskanzer.
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.